import java.util.ArrayList;
import java.util.stream.Stream;

public class StreamDemo {
    public static void main(String[] args) {
        ArrayList<String> objects = new ArrayList<>();
        objects.add("张三");
        objects.add("张三四");
        objects.add("王五");
        objects.add("王天龙");
        objects.add("张飞");
        objects.add("诸葛亮");
       // Stream<String> stream = objects.stream();
      //  stream.filter(s->s.startsWith("张")).filter(s -> s.length()==2).forEach(s-> System.out.println(s));
        objects.stream().filter(s->s.startsWith("张")).filter(s -> s.length()==2).forEach(s-> System.out.println(s));
    }
}
